package com.zkthink.ceres.product.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zkthink.base.entity.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 搜索历史表
 * </p>
 *
 * @author JustArgo
 * @since 2020-05-31
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_search_history")
@ApiModel(value = "SearchHistory", description = "搜索历史表")
@AllArgsConstructor
public class SearchHistory extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 会员id
     */
    @ApiModelProperty(value = "会员id")
    @TableField("mid")
    @Excel(name = "会员id")
    private Long mid;

    /**
     * 关键词
     */
    @ApiModelProperty(value = "关键词")
    @NotEmpty(message = "关键词不能为空")
    @Length(max = 255, message = "关键词长度不能超过255")
    @TableField(value = "keyword", condition = LIKE)
    @Excel(name = "关键词")
    private String keyword;

    /**
     * 逻辑删除 1-删除 0-未删除
     */
    @ApiModelProperty(value = "逻辑删除 1-删除 0-未删除")
    @NotNull(message = "逻辑删除 1-删除 0-未删除不能为空")
    @TableField("is_delete")
    @Excel(name = "逻辑删除 1-删除 0-未删除")
    private Integer isDelete;


    @Builder
    public SearchHistory(Long id, Long createUser, LocalDateTime createTime, Long updateUser, LocalDateTime updateTime, 
                    Long mid, String keyword, Integer isDelete) {
        this.id = id;
        this.createUser = createUser;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateTime = updateTime;
        this.mid = mid;
        this.keyword = keyword;
        this.isDelete = isDelete;
    }

}
